package com.sugon.modules.analyse.consts;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ： YuXD
 * @description： 设备KPI维度枚举类
 * @date ： 2020-11-15 上午 10:45
 * @version: 1.0
 */
public enum KpiTarget {

    PMWCL("PM完成率", "PMWCL", 1),
    PMYQL("PM延期率", "PMYQL", 1),
    MTBF("MTBF", "MTBF", 3),
    MTTR("MTTR", "MTTR", 3),
    OEE("OEE", "OEE", 3),
    QTJTXSJ("千台机停线时间", "QTJTXSJ", 3),
    SBKDL("设备开动率", "SBKDL", 4);

    private String label;

    private String value;

    private Integer level;

    KpiTarget(String label, String value, Integer level) {
        this.label = label;
        this.value = value;
        this.level = level;
    }

    /**
     * 获取指定level内的维度值列表
     *
     * @param level
     * @return
     */
    public static List<String> getKpiTargetValueListByLevel(Integer level) {
        return Arrays.stream(values()).filter(kpiTarget -> kpiTarget.getLevel() <= level).map(KpiTarget::getValue).collect(Collectors.toList());
    }

    public String getLabel() {
        return label;
    }

    public String getValue() {
        return value;
    }

    public Integer getLevel() {
        return level;
    }
}
